<!DOCTYPE html>
<html>
<head>
    <title>Physics Diagram</title>
    <style>
        canvas {
            border: 1px solid black;
        }
    </style>
</head>
<body>
    <canvas id="myCanvas" width="400" height="350"></canvas>
    <script>
        const canvas = document.getElementById('myCanvas');
        const ctx = canvas.getContext('2d');

        // Style settings
        ctx.fillStyle = 'white';
        ctx.fillRect(0, 0, canvas.width, canvas.height);
        ctx.strokeStyle = 'black';
        ctx.fillStyle = 'black';
        ctx.font = "20px 'Times New Roman'";
        ctx.textAlign = 'center';

        // Origin point
        const cx = 220;
        const cy = 190;

        // Draw Axes
        ctx.lineWidth = 2;
        // y-axis
        ctx.beginPath();
        ctx.moveTo(cx, cy);
        ctx.lineTo(cx, 50);
        ctx.stroke();
        ctx.fillText('y', cx, 40);

        // z-axis
        ctx.beginPath();
        ctx.moveTo(cx, cy);
        ctx.lineTo(380, cy);
        ctx.stroke();
        ctx.fillText('z', 390, cy + 5);

        // -x-axis
        const nx_end_x = cx - 120;
        const nx_end_y = cy + 80;
        ctx.beginPath();
        ctx.moveTo(cx, cy);
        ctx.lineTo(nx_end_x, nx_end_y);
        ctx.stroke();
        ctx.fillText('-x', nx_end_x - 15, nx_end_y + 10);

        // Draw Wires
        ctx.lineWidth = 3;
        const wire1_x = 170;
        const wire2_x = 140;
        // Wire 1 (closer)
        ctx.beginPath();
        ctx.moveTo(wire1_x, 110);
        ctx.lineTo(wire1_x, 230);
        ctx.stroke();
        // Wire 2 (further)
        ctx.beginPath();
        ctx.moveTo(wire2_x, 130);
        ctx.lineTo(wire2_x, 250);
        ctx.stroke();

        // Draw Currents
        ctx.lineWidth = 1.5;
        // Current on Wire 1
        ctx.fillText('I', wire1_x - 30, 175);
        ctx.beginPath();
        ctx.moveTo(wire1_x - 15, 180);
        ctx.lineTo(wire1_x - 15, 160);
        ctx.stroke();
        ctx.beginPath(); // Arrowhead
        ctx.moveTo(wire1_x - 15, 160);
        ctx.lineTo(wire1_x - 15 - 4, 167);
        ctx.moveTo(wire1_x - 15, 160);
        ctx.lineTo(wire1_x - 15 + 4, 167);
        ctx.stroke();

        // Current on Wire 2
        ctx.fillText('I', wire2_x - 30, 195);
        ctx.beginPath();
        ctx.moveTo(wire2_x - 15, 200);
        ctx.lineTo(wire2_x - 15, 180);
        ctx.stroke();
        ctx.beginPath(); // Arrowhead
        ctx.moveTo(wire2_x - 15, 180);
        ctx.lineTo(wire2_x - 15 - 4, 187);
        ctx.moveTo(wire2_x - 15, 180);
        ctx.lineTo(wire2_x - 15 + 4, 187);
        ctx.stroke();

        // Draw Dimension '2a'
        // In the original image, this is drawn confusingly.
        // We will draw it between the two wires, parallel to the drawn x-axis, which is consistent with the problem statement.
        // The dimension line is between the two wires, in a way that looks like it's in a plane parallel to the x-z plane.
        
        ctx.lineWidth = 1;
        
        const dim_start_y = 100; // y-level on the canvas for the dimension line start
        const dim_p1 = {x: wire1_x, y: dim_start_y };
        const dim_p2 = {x: wire2_x, y: dim_start_y + 20}; // to make it parallel to -x axis slope

        // Ticks are perpendicular to the dimension line. The tick marks in the original are nearly vertical.
        // So we will draw them vertically.
        const tick_len = 8;
        ctx.beginPath();
        ctx.moveTo(dim_p1.x, dim_p1.y - tick_len/2);
        ctx.lineTo(dim_p1.x, dim_p1.y + tick_len/2);
        ctx.stroke();
        
        ctx.beginPath();
        ctx.moveTo(dim_p2.x, dim_p2.y - tick_len/2);
        ctx.lineTo(dim_p2.x, dim_p2.y + tick_len/2);
        ctx.stroke();
        
        // Let's make the dimension line horizontal as it is more clear and still conveys the separation '2a'
        const dim_y = 90;
        ctx.beginPath();
        ctx.moveTo(wire1_x, dim_y);
        ctx.lineTo(wire2_x, dim_y);
        ctx.stroke();
        
        // Vertical ticks for horizontal dimension line
        ctx.beginPath();
        ctx.moveTo(wire1_x, dim_y - tick_len/2);
        ctx.lineTo(wire1_x, dim_y + tick_len/2);
        ctx.stroke();
        
        ctx.beginPath();
        ctx.moveTo(wire2_x, dim_y - tick_len/2);
        ctx.lineTo(wire2_x, dim_y + tick_len/2);
        ctx.stroke();

        // Label '2a'
        ctx.fillText('2a', (wire1_x + wire2_x)/2, dim_y - 10);
        

        // Figure caption
        ctx.font = "bold 20px 'Times New Roman'";
        ctx.fillText('Fig. 2.75', canvas.width / 2, 330);
    </script>
</body>
</html>